<?php
/* Application_Form_Buyer class
 * Class Untuk Membuat Form untuk entity Buyer
 * Author Radhityo Rujito
 * PT BitZero Informatika
 */
class Application_Form_Complain extends Zend_Form
{

    public function init()
    {
        $this->setName('complain');//set the Form Name to Buyer
        /*Create Form Object buyerID
         * set filter = Must be an Integer
         */
          $id=new Zend_Form_Element_Hidden('id');
          $id->addFilter('Int');

          $buyer_id=new Zend_Form_Element_Hidden('buyer_id');
          $buyer_id->addFilter('Int');
          $admin_id=new Zend_Form_Element_Hidden('admin_id');
          $admin_id->addFilter('Int');


          /* Create Form Object complain => Buyer's Complain
           * Filter :
           * 1. cannot input HTML Tags
           * 2. delete spaces at the beginning and  the end of buyer's name
           */
          $complain = new Zend_Form_Element_Textarea('complain');
          $complain->setRequired(true)
                  ->addFilter('stripTags')
                  ->addFilter('stringTrim')
                  ->setAttrib('cols', '50')
                  ->setAttrib('rows', '6')
                  ->addValidator('NotEmpty')
                  ->addErrorMessages(array('notEmpty'=>'Mohon isi Komplen yang hendak anda sampaikan'))
                  ->setAttrib('rows', '4');

          /*Create Form Object response_msg => admin's response message
           * 1. cannot input HTML Tags
           * 2. delete spaces at the beginning and  the end of
           * buyer's name
           * 3. Set String To Lower Case
           */
          $response_msg = new Zend_Form_Element_Textarea('response_msg');
          $response_msg->setRequired(true)
                  ->addFilter('stripTags')
                  ->addFilter('stringTrim')
                  ->setAttrib('cols', '50')
                  ->setAttrib('rows', '6')
                  ->addValidator('NotEmpty')
                  ->addErrorMessages(array('notEmpty'=>'Mohon balasan Komplen yang hendak anda sampaikan'))
                  ->setAttrib('rows', '4');
           /*
            * Create Object Form title
            */
           $title = new Zend_form_element_text('title');
           $title ->setRequired(true)
                      ->addFilter('stripTags')
                      ->addFilter('stringTrim')
                      ->addValidator('NotEmpty')
                      ->addErrorMessages(array('notEmpty'=>'Mohon Judul Komplen'))
                      ->setAttrib('maxlength', '50');
          


           $submit = new Zend_Form_Element_Submit('submit');
           $submit->setAttrib('id', 'submitBuyer');
           /*
            * Create Object Form Reset Button
            */
           $reset = new Zend_Form_Element_Reset('reset');
           $reset->setAttrib('id','resetBuyer');


             $this->addElements(array($id,$admin_id,$buyer_id,$complain,
                 $title,$response_msg,$submit,$reset));


    }

}

?>